1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.google.common.collect;
18
19 import java.util.Collection;
20 import java.util.List;
21
22 import javax.annotation.Nullable;
23
24
25
26
27
28
29
30 abstract class ForwardingImmutableList<E> extends ImmutableList<E> {
31
32 ForwardingImmutableList() {
33 }
34
35 abstract List<E> delegateList();
36
37 public int indexOf(@Nullable Object object) {
38 return delegateList().indexOf(object);
39 }
40
41 public int lastIndexOf(@Nullable Object object) {
42 return delegateList().lastIndexOf(object);
43 }
44
45 public E get(int index) {
46 return delegateList().get(index);
47 }
48
49 public ImmutableList<E> subList(int fromIndex, int toIndex) {
50 return unsafeDelegateList(delegateList().subList(fromIndex, toIndex));
51 }
52
53 @Override public Object[] toArray() {
54
55
56 return delegateList().toArray(new Object[size()]);
57 }
58
59 @Override public boolean equals(Object obj) {
60 return delegateList().equals(obj);
61 }
62
63 @Override public int hashCode() {
64 return delegateList().hashCode();
65 }
66
67 @Override public UnmodifiableIterator<E> iterator() {
68 return Iterators.unmodifiableIterator(delegateList().iterator());
69 }
70
71 @Override public boolean contains(@Nullable Object object) {
72 return object != null && delegateList().contains(object);
73 }
74
75 @Override public boolean containsAll(Collection<?> targets) {
76 return delegateList().containsAll(targets);
77 }
78
79 public int size() {
80 return delegateList().size();
81 }
82
83 @Override public boolean isEmpty() {
84 return delegateList().isEmpty();
85 }
86
87 @Override public <T> T[] toArray(T[] other) {
88 return delegateList().toArray(other);
89 }
90
91 @Override public String toString() {
92 return delegateList().toString();
93 }
94 }